package co.gov.medellin.ssti.sub.model.service.impl;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import co.gov.medellin.ssti.sub.model.dao.exception.DAOException;
import co.gov.medellin.ssti.sub.model.dao.impl.AreaDAOImpl2;
import co.gov.medellin.ssti.sub.model.service.AreaService;
import co.gov.medellin.ssti.sub.model.vo.AreaVO;

@Service
public class AreaServiceImpl implements AreaService {
	@Autowired
	AreaDAOImpl2 areaDAOImpl2;

	public Collection<AreaVO> findAreas(String strNombreArea)
			throws DAOException {
		try {
			return areaDAOImpl2.findAreas(strNombreArea);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<AreaVO> findAllAreas() {
		try {
			return areaDAOImpl2.findAllAreas();
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<AreaVO> findArea(String strCode) {
		try {
			return areaDAOImpl2.findArea(strCode);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int insertArea(String[] Arr) {
		try {
			return areaDAOImpl2.insertArea(Arr);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int updateArea(String[] Arr, String strCode) {
		try {
			return areaDAOImpl2.updateArea(Arr, strCode);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public int updateSubArea(String[] Arr, String strCode) {
		try {
			return areaDAOImpl2.updateSubArea(Arr, strCode);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<AreaVO> findAllSubAreas(String strCodeArea) {
		try {
			return areaDAOImpl2.findAllSubAreas(strCodeArea);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<AreaVO> findAreasAuthorized(String strCodeUsu,
			String strGroupUser) {
		try {
			return areaDAOImpl2.findAreasAuthorized(strCodeUsu, strGroupUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<AreaVO> findAreasAuthorizedWithGestor(String strCodeUsu,
			String strGroupUser) {
		try {
			return areaDAOImpl2.findAreasAuthorizedWithGestor(strCodeUsu,
					strGroupUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public AreaVO findAreaByProg(String strCodeProg) {
		try {
			return areaDAOImpl2.findAreaByProg(strCodeProg);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

}
